﻿using Dispatcher.Tasks.Services;
using MiniFox.Tasks;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Dispatcher.Tasks
{
    public class QueueTask : TaskAction
    {
        public QueueTask(string name) : base(name)
        {
            this.ErrorHandled += Task_ErrorHandled;
        }

        private void Task_ErrorHandled(object sender, ErrorHandleEventArgs e)
        {
            e.IgnoreException = true;
        }

        protected override void Process()
        {
            var queueService = this.Container.GetComponentByName<QueueService>(this.Name, this.Name);
            queueService.Pull();
        }
    }
}
